// JavaScript Document
$(document).ready(function(){
/*login登录页面*/	
	var regUser=/^\w{5,20}$/;
	var regPassword=/^\w{6,18}$/;
	var regTel=/^1[34578]\d{9}$/;
	var regEmail=/^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$/;
	var userName="";
	var userPassword="";
	var userConfirmPassword="";
	var userTel="";
	var userEmail="";
	var userCaptcha="";
	var userCaptchaTel="";
	//按钮可用
	function ableButton(conditionObeying){
		if(conditionObeying){
			$(".lg_button input").removeAttr("disabled","disabled");
			$(".lg_button input").css("background","#0280ff");
		}
	}
	//错误提示背景
	function wrongPoints(elements, values){
		$(elements).css("background-image", values);
	}
	//用户名验证
	$(".lg_zh input").on("blur", function(){
		userName=$(".lg_zh input").val();
		if(regUser.test(userName)){
			$(".lg_zh input").next().removeClass("lg_pointShow");
		}else{
			wrongPoints(".lg_zh input", "url(../../resources/js/wechat/images/ico_dlzh.png), url(../../resources/js/wechat/images/wrong.png)");
			$(".lg_zh input").next().addClass("lg_pointShow");
		}
	});;;;;
	$(".lg_zh input").on("focus", function(){
		wrongPoints(".lg_zh input", "url(../../resources/js/wechat/images/ico_dlzh.png)");
		$(".lg_zh input").next().removeClass("lg_pointShow");
	});;;;;
	//密码验证
	$(".lg_ps input").on("blur", function(){
		userPassword=$(".lg_ps input").val();
		if(regPassword.test(userPassword)){
			$(".lg_ps input").next().removeClass("lg_pointShow");
		}else{
			wrongPoints(".lg_ps input", "url(../../resources/js/wechat/images/ico_dlmm.png), url(../../resources/js/wechat/images/wrong.png)");
			$(".lg_ps input").next().addClass("lg_pointShow");
		}
	});;;;;
	$(".lg_ps input").on("focus", function(){
		wrongPoints(".lg_ps input", "url(../../resources/js/wechat/images/ico_dlmm.png)");
		$(".lg_ps input").next().removeClass("lg_pointShow");
	});;;;;
	//确认密码
	$(".lg_qrmm input").on("blur", function(){
		userConfirmPassword=$(".lg_qrmm input").val();
		if(userConfirmPassword==userPassword && userConfirmPassword!=""){
			$(".lg_qrmm input").next().removeClass("lg_pointShow");
		}else{
			wrongPoints(".lg_qrmm input", "url(../../images/ico_qrmm.png), url(../../images/wrong.png)");
			$(".lg_qrmm input").next().addClass("lg_pointShow");
		}
	});;;;;
	$(".lg_qrmm input").on("focus", function(){
		wrongPoints(".lg_qrmm input", "url(../../images/ico_qrmm.png)");
		$(".lg_qrmm input").next().removeClass("lg_pointShow");
	});;;;;
	//邮箱输入
	$(".lg_em input").on("blur", function(){
		userEmail=$(".lg_em input").val();
		if(regEmail.test(userEmail)){
			$(".lg_em input").next().removeClass("lg_pointShow");
		}else{
			wrongPoints(".lg_em input", "url(../../images/ic_youxiang.png), url(../../images/wrong.png)");
			$(".lg_em input").next().addClass("lg_pointShow");
		}
	});;;;;
	$(".lg_em input").on("focus", function(){
		wrongPoints(".lg_em input", "url(../../images/ic_youxiang.png)");
		$(".lg_em input").next().removeClass("lg_pointShow");
	});;;;;
	//手机输入
	$(".lg_sr input").on("blur", function(){
		userTel=$(".lg_sr input").val();
		if(regTel.test(userTel)){
			$(".lg_sr input").next().removeClass("lg_pointShow");
		}else{
			wrongPoints(".lg_sr input", "url(../../images/ico_dlzh.png), url(../../images/wrong.png)");
			$(".lg_sr input").next().addClass("lg_pointShow");
		}
	});;;;;
	$(".lg_sr input").on("focus", function(){
		wrongPoints(".lg_sr input", "url(../../images/ico_dlzh.png)");
		$(".lg_sr input").next().removeClass("lg_pointShow");
	});;;;;
	//验证码
	$(".lg_yzm input").on("blur", function(){
		userCaptcha=$(".lg_yzm input").val();
		if(userCaptcha!=""){
			$(".lg_yzm input").next().removeClass("lg_pointShow");
		}else{
			wrongPoints(".lg_yzm input", "url(../../images/wrong.png)");
			$(".lg_yzm input").next().addClass("lg_pointShow");
		}
	});;;;;
	$(".lg_yzm input").on("focus", function(){
		wrongPoints(".lg_yzm input", "none");
		$(".lg_yzm input").next().removeClass("lg_pointShow");
	});;;;;
	//手机验证码
	$(".lg_sjyzm input").on("blur", function(){
		userCaptchaTel=$(".lg_sjyzm input").val();
		if(userCaptchaTel!=""){
			$(".lg_sjyzm input").next().removeClass("lg_pointShow");
		}else{
			wrongPoints(".lg_sjyzm input", "url(../../images/wrong.png)");
			$(".lg_sjyzm input").next().addClass("lg_pointShow");
		}
	});;;;;
	$(".lg_sjyzm input").on("focus", function(){
		wrongPoints(".lg_sjyzm input", "none");
		$(".lg_sjyzm input").next().removeClass("lg_pointShow");
	});;;;;
//login页面按钮解禁
	$(".loginyzm").on("focus", function(){
		ableButton(regUser.test(userName) && regPassword.test(userPassword));
	});;;;;
//zhaohuimm页面按钮解禁
	$(".zhaohuimmyhm").keyup(function(){
		ableButton(userName!="");
	});;;;;
//sjzh页面按钮解禁
	$(".sjzhyzm").on("focus", function(){
		ableButton(regPassword.test(userPassword) && userConfirmPassword==userPassword && userConfirmPassword!="");
	});;;;;
//zhuce页面按钮解禁
	$(".zhuce_two").hide();
	$(".zhuceyzm").on("focus", function(){
		ableButton(regUser.test(userName) && regEmail.test(userEmail) && regTel.test(userTel));
	});;;;;
	$(".zhuceNext").on("click", function(){
		$(".zhuce_one").slideUp(500);
		setTimeout($(".zhuce_two").slideDown(500),500);
		$(".lg_button input").attr("disabled","disabled");
		$(".lg_button input").css("background","#999");
	});;;;;
	$(".zhucepsd").on("focus", function(){
		ableButton(regPassword.test(userPassword));
	})

	


});;;;;
